﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGS.Standard;

namespace SGS
{
    public class GamePool
    {
        Dictionary<int, GameContext> _pool;
        public GamePool()
        {
            _pool = new Dictionary<int, GameContext>();
        }

        static GamePool _poolinstance;
        public static GamePool Instance
        {
            get
            {
                if( _poolinstance == null )
                {
                    _poolinstance = new GamePool();
                }
                return _poolinstance;
            }
        }
        
        public void Set( GameContext game )
        {
            this._pool.Add( System.Threading.Thread.CurrentThread.GetHashCode(), game );
        }

        public GameContext GetCurrent()
        {
            return this._pool[System.Threading.Thread.CurrentThread.GetHashCode()];
        }

        public static GameContext Current
        {
            get
            {
                return Instance.GetCurrent();
            }
        }

        // 
    }
}
